<?php

namespace Server\Controller;
use Think\Controller\HproseController;
class AdminController extends HproseController {
    public function haha($p,$i){
        $error = cookie('errorasddasgmsgasklgkla');
        if($error > 5){
            $result['success'] = 0;
            $result['info'] = '登录太频繁！';
        }
        else{
            $data['id'] = $i;
            $data['password'] = base64_encode($p);
            $data['type'] = 3;
            $res = M('student')->field('id','name')->where($data)->select();
            if(empty($res)){
                $res = M('teacher')->field('id','name')->where($data)->select();
                if(empty($res)){
                    $result['success'] = 0;
                    $result['info'] = ‘账号或密码错误’;
                    if(empty($error))
                        $error = 1;
                    $error++;
                    setcookie('errorasddasgmsgasklgkla',$user,3600,'/');
                }
                else{
                    $this->Redirect('Index/home', array('wgateid'=>$wgateid),1, '页面跳转中...')
                }
            }
            else{
                $result['success'] = 1;
            }
        }
        return json_encode($result);
    }
}
